#include<iostream>
#include<algorithm>
using namespace std;

struct stu {
	int speed;
	string name;
};

bool cmp(stu a,stu b) {
	if(a.speed!=b.speed) {
		return a.speed<b.speed;
	} else
		return a.name>b.name;

}

stu a[1000];

int main() {
	int n,m;
	cin>>n>>m;
	for(int i=0; i<n; i++) {
		cin>>a[i].name>>a[i].speed;
	}
	sort(a,a+n,cmp);
	cout<<a[m-1].name<<endl;
	return 0;
}
